/**
 * Copyright (c) 2018-2023, NXOS Development Team
 * SPDX-License-Identifier: Apache-2.0
 * 
 * Contains: cache for x86
 * 
 * Change Logs:
 * Date           Author            Notes
 * 2023-08-15     JasonHu           Init
 */

#include <base/cache.h>

#ifdef CONFIG_X86_CACHE_GENERIC

#define X86_CACHE_LINE_SIZE 64

NX_PRIVATE NX_U32 X86_DcacheStatus(void)
{
    return NX_CACHE_ENABLED;
}

NX_PRIVATE NX_U32 X86_IcacheStatus(void)
{
    return NX_CACHE_ENABLED;
}

NX_PRIVATE NX_U32 X86_DcacheLineSize(void)
{
    return X86_CACHE_LINE_SIZE;
}

NX_PRIVATE NX_U32 X86_IcacheLineSize(void)
{
    return X86_CACHE_LINE_SIZE;
}

NX_INTERFACE struct NX_CacheOps NX_CacheOpsInterface = 
{
    .dcacheEnable                   = NX_NULL,
    .dcacheDisable                  = NX_NULL,
    .icacheEnable                   = NX_NULL,
    .icacheDisable                  = NX_NULL,
    .dcacheStatus                   = X86_DcacheStatus,
    .icacheStatus                   = X86_IcacheStatus,
    .dcacheLineSize                 = X86_DcacheLineSize,
    .icacheLineSize                 = X86_IcacheLineSize,
    .icacheInvalidateAll            = NX_NULL,
    .icacheInvalidateLine           = NX_NULL,
    .icacheInvalidateRange          = NX_NULL,
    .dcacheInvalidateAll            = NX_NULL,
    .dcacheInvalidateLine           = NX_NULL,
    .dcacheInvalidateRange          = NX_NULL,
    .dcacheFlushAll                 = NX_NULL,
    .dcacheFlushLine                = NX_NULL,
    .dcacheFlushRange               = NX_NULL,
    .dcacheClearAll                 = NX_NULL,
    .dcacheClearLine                = NX_NULL,
    .dcacheClearRange               = NX_NULL,
    .dcacheFlushIcacheInvalidate    = NX_NULL,
};
#endif
